package com.mdinic.blogovi.front.common;

import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.image.ContextImage;

import com.mdinic.blogovi.model.Person;

public class PersonPhoto extends ContextImage {

    private static final long serialVersionUID = 1L;

    private static final String NOPHOTO = "unknown_person.png";

    public PersonPhoto(String id, Person person) {
        super(id, "/../images/blogovi/p/");
        add(new AttributeAppender("src", person.getPicture() == null ? NOPHOTO : person.getPicture()));
    }

}
